<?php

namespace App\Http\Controllers;

use App\User;

class RegisterController extends Controller
{
	/**
	 * @return array
	 */
    public function register(){
        $insert_data['email'] = $_POST['email'];
		$insert_data['user_name'] = $_POST['user_name'];
		$insert_data['salt_word'] = User::set_salt();
		$insert_data['password'] = User::encrypt_password($_POST['password'], $insert_data['salt_word']);
		if(User::add($insert_data)){
			return $this->successResponse();
		}else{
			return $this->failResponse();
		}
    }
}
